package com.hnkywl.sts.entity.organ;

import com.hnkywl.sts.entity.base.Sjzdz;
import com.hnkywl.sts.entity.sys.Yg;
import org.hibernate.annotations.Where;

import javax.persistence.*;
import java.util.List;

/**
 * 说明：内部部门
 * 包:        com.hnkywl.sts.entity.organ
 * 类描述:    内部部门
 * 修改备注: [说明本次修改内容]
 * 版本:        [v1.0]
 */
@Entity
@DiscriminatorValue("nbbm")
public class Nbbm extends Gsjg{
    /**
     * 部门经理
     */
    @ManyToOne
    @JoinColumn(name = "BMJL_ID")
    private Yg bmjl;

    /**
     * 日常管理
     */
    @ManyToOne
    @JoinColumn(name = "RCGL_ID")
    private Yg rcgl;

    /**
     * 部门职责
     */
    private String bmzz;

    /**
     * 是否经营机构
     */
    private Boolean sfjyzz;

    /**
     * 是否供应站
     */
    private Boolean sfgyz;

    /**
     * 供应站部门关联的仓库
     */
    @OneToMany(cascade = CascadeType.MERGE, fetch = FetchType.LAZY, targetEntity = Ck.class)
    @JoinColumn(name = "SSGYZ_ID")
    @Where(clause = "deleted=0")
    private List<Ck> glckList;

    @ManyToMany(cascade = CascadeType.MERGE, fetch = FetchType.LAZY, targetEntity = Ck.class)
    @JoinTable( name="NBBM_CK", //中间表名
            joinColumns=@JoinColumn(name="BM_ID"), // 列名LEADER_ID
            inverseJoinColumns=@JoinColumn(name="CK_ID") // 列名  EMPEE_I
    )
    @Where(clause = "deleted=0")
    private List<Ck> khckList;

    /**
     * 是否资金占用
     */
    private Boolean sfzjzy;

    /**
     * 是否保供业务部门,1：是，0，null：不是
     */
    private Boolean sfbgyw;

    /**
     * 考核部门
     */
    @ManyToOne
    @JoinColumn(name = "KHBM_ID")
    private Nbbm khbm;

    /**
     * 是否债权债务转移
     */
    private Boolean sfzqzwz;

    /**
     * 考核公司
     */
    @ManyToOne
    @JoinColumn(name = "KHGS_ID")
    private Nbgs khgs;

    //TO-DO 下面还有两个属性
    /**
     * 成本费用
     */
    @ManyToOne
    @JoinColumn(name="SJZDZ_CBFY_ID")
    private Sjzdz cbfy;

    /**
     * 业务考核
     */
    @ManyToOne
    @JoinColumn(name="YWKH_ID")
    private Nbbm ywkh;

    public Yg getBmjl() {
        return bmjl;
    }

    public void setBmjl(Yg bmjl) {
        this.bmjl = bmjl;
    }

    public Yg getRcgl() {
        return rcgl;
    }

    public void setRcgl(Yg rcgl) {
        this.rcgl = rcgl;
    }

    public String getBmzz() {
        return bmzz;
    }

    public void setBmzz(String bmzz) {
        this.bmzz = bmzz;
    }

    public Boolean getSfjyzz() {
        return sfjyzz;
    }

    public void setSfjyzz(Boolean sfjyzz) {
        this.sfjyzz = sfjyzz;
    }

    public Boolean getSfgyz() {
        return sfgyz;
    }

    public void setSfgyz(Boolean sfgyz) {
        this.sfgyz = sfgyz;
    }

    public Boolean getSfzjzy() {
        return sfzjzy;
    }

    public void setSfzjzy(Boolean sfzjzy) {
        this.sfzjzy = sfzjzy;
    }

    public Nbbm getKhbm() {
        return khbm;
    }

    public void setKhbm(Nbbm khbm) {
        this.khbm = khbm;
    }

    public Boolean getSfzqzwz() {
        return sfzqzwz;
    }

    public void setSfzqzwz(Boolean sfzqzwz) {
        this.sfzqzwz = sfzqzwz;
    }

    public Nbgs getKhgs() {
        return khgs;
    }

    public void setKhgs(Nbgs khgs) {
        this.khgs = khgs;
    }

    public Sjzdz getCbfy() {
        return cbfy;
    }

    public void setCbfy(Sjzdz cbfy) {
        this.cbfy = cbfy;
    }

    public Nbbm getYwkh() {
        return ywkh;
    }

    public void setYwkh(Nbbm ywkh) {
        this.ywkh = ywkh;
    }

    public List<Ck> getGlckList() {
        return glckList;
    }

    public void setGlckList(List<Ck> glckList) {
        this.glckList = glckList;
    }

    public List<Ck> getKhckList() {
        return khckList;
    }

    public void setKhckList(List<Ck> khckList) {
        this.khckList = khckList;
    }

    public Boolean getSfbgyw() {
        return sfbgyw;
    }

    public void setSfbgyw(Boolean sfbgyw) {
        this.sfbgyw = sfbgyw;
    }

    public String className(){
        return "Nbbm";
    }
}
